import Vue from 'vue'
import Vuex from 'vuex'
import { Notification  } from 'element-ui';
import router from '@/router/index.js';
Vue.use(Vuex)

const store = new Vuex.Store({
  state: {
    selectIndex: 0,
    isAudit: 0,
    oldAudit: 0,
  },
  mutations: {
    changeIndex(state, value) {
      state.selectIndex = value;
    },
    changeAudit(state, value) {
      if (value > 0 && value > state.isAudit && sessionStorage.getItem('KEY') == 'C' && state.oldAudit < value) {
        Notification.success({
          title: '提示',
          message: '您有新的待审核信息，请刷新一下',
          duration:5000
        });
      }
      state.isAudit = value;
      state.oldAudit = value;
    },

  },
})
export default store;